//
//  RegisterViewController.m
//  Products_B
//
//  Created by lanou on 16/6/7.
//  Copyright © 2016年 朋学友. All rights reserved.
//

#import "RegisterViewController.h"

#define KRegisterURL @"http://api.izhangchu.com/?appVersion=4.4&sysVersion=9.3.2&devModel=iPhone"

@interface RegisterViewController () <UITextFieldDelegate>
@property (weak, nonatomic) IBOutlet UITextField *numPhoneTf;
@property (weak, nonatomic) IBOutlet UITextField *imgIdentifyTf;
@property (weak, nonatomic) IBOutlet UITextField *phoneIdentifyTf;
@property (weak, nonatomic) IBOutlet UIButton *changeButton;
@property (weak, nonatomic) IBOutlet UIImageView *picImageView;
@property (weak, nonatomic) IBOutlet UIButton *getIdentifyButton;
@property (weak, nonatomic) IBOutlet UIButton *nextButton;

@end

@implementation RegisterViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    self.navigationItem.title = @"注册";
    
    [self requestIdData];
}

- (void)requestIdData {
    NSDictionary *parDic = @{@"methodName":@"UserVerify",@"token":@"",@"user_id":@"",@"version":@4.4};
    [RequestManager requestWithUrl:KRegisterURL requestType:RequestTypePOST parDic:parDic finish:^(NSData *data) {
        NSDictionary *jsonDic = [NSJSONSerialization JSONObjectWithData:data options:0 error:nil];
  
        NSLog(@" ++ %@",jsonDic);

        _picImageView.image = [UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:jsonDic[@"data"][@"image"]]]];
         NSLog(@" ++ %@",_picImageView.image);
        
    } error:^(NSError *error) {
        NSLog(@"请求数据失败");
    }];
}

- (IBAction)registerAction:(UIButton *)sender {
   
}

- (BOOL)textFieldShouldReturn:(UITextField *)textField {
    [textField resignFirstResponder];
    return YES;
}

- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
    [_numPhoneTf resignFirstResponder];
    [_imgIdentifyTf resignFirstResponder];
    [_phoneIdentifyTf resignFirstResponder];
}

- (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
    if (self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]) {
        self.hidesBottomBarWhenPushed = YES;
    }
    return self;
}



- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
